<?php

class TarjetasAmarillasValidator extends sfValidatorBase
{
	
	protected function configure($options = array(), $messages = array()) {
		
		$this->addOption('a');
		$this->addOption('0');
		$this->min = 0;
		$this->max = 2;

	}	
	
	protected function doClean($value)
	{
		$amarillas = $value[$this->getOption('a')];
		if ($amarillas !=null)
		{
			$amarillas = intval($amarillas);
			if ($amarillas > $this->max || $amarillas<$this->min) {
				//$this->messages = array('invalid' => 'La cantidad de tarjetas amarillas es invalida'); 
				throw new sfValidatorError($this, 'invalid', array('value' => $value));
			
		}
		}
		
		
		return $value;
	}

}
?>